home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
CIncludes
/
CTBUtilities.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-01
|
6KB
|
219 lines
/*
File: CTBUtilities.h
Contains: Communications Toolbox Utilities interfaces.
Version: Technology: System 7.5
Release: Universal Interfaces 3.0d3 on Copland DR1
Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
*/
#ifndef __CTBUTILITIES__
#define __CTBUTILITIES__
#ifndef __MEMORY__
#include <Memory.h>
#endif
#ifndef __DIALOGS__
#include <Dialogs.h>
#endif
#ifndef __APPLETALK__
#include <AppleTalk.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
#if FOR_SYSTEM7_ONLY
enum {
/* version of Comm Toolbox Utilities */
curCTBUVersion = 2, /* Error codes/types */
ctbuGenericError = -1,
ctbuNoErr = 0
};
typedef OSErr CTBUErr;
enum {
chooseDisaster = -2,
chooseFailed = -1,
chooseAborted = 0,
chooseOKMinor = 1,
chooseOKMajor = 2,
chooseCancel = 3
};
typedef unsigned short ChooseReturnCode;
enum {
nlOk = 0,
nlCancel = 1,
nlEject = 2
};
typedef unsigned short NuLookupReturnCode;
enum {
nameInclude = 1,
nameDisable = 2,
nameReject = 3
};
typedef unsigned short NameFilterReturnCode;
enum {
zoneInclude = 1,
zoneDisable = 2,
zoneReject = 3
};
typedef unsigned short ZoneFilterReturnCode;
enum {
/* Values for hookProc items */
hookOK = 1,
hookCancel = 2,
hookOutline = 3,
hookTitle = 4,
hookItemList = 5,
hookZoneTitle = 6,
hookZoneList = 7,
hookLine = 8,
hookVersion = 9,
hookReserved1 = 10,
hookReserved2 = 11,
hookReserved3 = 12,
hookReserved4 = 13, /* "virtual" hookProc items */
hookNull = 100,
hookItemRefresh = 101,
hookZoneRefresh = 102,
hookEject = 103,
hookPreflight = 104,
hookPostflight = 105,
hookKeyBase = 1000
};
/* NuLookup structures/constants */
struct NLTypeEntry {
Handle hIcon;
Str32 typeStr;
};
typedef struct NLTypeEntry NLTypeEntry;
typedef NLTypeEntry NLType[4];
struct NBPReply {
EntityName theEntity;
AddrBlock theAddr;
};
typedef struct NBPReply NBPReply;
typedef pascal short (*DialogHookProcPtr)(short item, DialogPtr theDialog);
typedef pascal short (*NameFilterProcPtr)(EntityName *theEntity);
typedef pascal short (*ZoneFilterProcPtr)(ConstStr32Param theZone);
#if GENERATINGCFM
typedef UniversalProcPtr DialogHookUPP;
typedef UniversalProcPtr NameFilterUPP;
typedef UniversalProcPtr ZoneFilterUPP;
#else
typedef DialogHookProcPtr DialogHookUPP;
typedef NameFilterProcPtr NameFilterUPP;
typedef ZoneFilterProcPtr ZoneFilterUPP;
#endif
enum {
uppDialogHookProcInfo = kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(short)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DialogPtr))),
uppNameFilterProcInfo = kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(short)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EntityName *))),
uppZoneFilterProcInfo = kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(short)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ConstStr32Param*)))
};
#if GENERATINGCFM
#define NewDialogHookProc(userRoutine) \
(DialogHookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDialogHookProcInfo, GetCurrentArchitecture())
#define NewNameFilterProc(userRoutine) \
(NameFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppNameFilterProcInfo, GetCurrentArchitecture())
#define NewZoneFilterProc(userRoutine) \
(ZoneFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppZoneFilterProcInfo, GetCurrentArchitecture())
#else
#define NewDialogHookProc(userRoutine) \
((DialogHookUPP) (userRoutine))
#define NewNameFilterProc(userRoutine) \
((NameFilterUPP) (userRoutine))
#define NewZoneFilterProc(userRoutine) \
((ZoneFilterUPP) (userRoutine))
#endif
#if GENERATINGCFM
#define CallDialogHookProc(userRoutine, item, theDialog) \
CallUniversalProc((UniversalProcPtr)(userRoutine), uppDialogHookProcInfo, (item), (theDialog))
#define CallNameFilterProc(userRoutine, theEntity) \
CallUniversalProc((UniversalProcPtr)(userRoutine), uppNameFilterProcInfo, (theEntity))
#define CallZoneFilterProc(userRoutine, theZone) \
CallUniversalProc((UniversalProcPtr)(userRoutine), uppZoneFilterProcInfo, (theZone))
#else
#define CallDialogHookProc(userRoutine, item, theDialog) \
(*(userRoutine))((item), (theDialog))
#define CallNameFilterProc(userRoutine, theEntity) \
(*(userRoutine))((theEntity))
#define CallZoneFilterProc(userRoutine, theZone) \
(*(userRoutine))((theZone))
#endif
extern pascal CTBUErr InitCTBUtilities(void );
extern pascal short CTBGetCTBVersion(void );
extern pascal short StandardNBP(Point where, ConstStr255Param prompt, short numTypes, NLType typeList, NameFilterUPP nameFilter, ZoneFilterUPP zoneFilter, DialogHookUPP hook, NBPReply *theReply);
extern pascal short CustomNBP(Point where, ConstStr255Param prompt, short numTypes, NLType typeList, NameFilterUPP nameFilter, ZoneFilterUPP zoneFilter, DialogHookUPP hook, long userData, short dialogID, ModalFilterUPP filter, NBPReply *theReply);
#if OLDROUTINENAMES
#define NuLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter, \
hook, theReply) \
StandardNBP(where, prompt, numTypes, typeList, nameFilter, zoneFilter, \
hook, theReply)
#define NuPLookup(where, prompt, numTypes, typeList, nameFilter, \
zoneFilter, hook, userData, dialogID, filter, theReply) \
CustomNBP(where, prompt, numTypes, typeList, nameFilter, \
zoneFilter, hook, userData, dialogID, filter, theReply)
#endif
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import off
#endif
#ifdef __cplusplus
}
#endif
#endif /* __CTBUTILITIES__ */